import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { param } from '@/utils/index'

// 主播申请分页
export function pagingAnchorApply(qurey) {
  return request({
    url: '/user/memberAnchorAuthority/pagingAnchorApply',
    method: 'get',
    params: qurey
  })
}

// 统计各状态主播数量
export function statAnchor(qurey) {
  return request({
    url: '/user/memberAnchorAuthority/statAnchor',
    method: 'get',
    params: qurey
  })
}

/**
 * 获取企业主播管理提示 0: 关闭  1：开启
 */
export function getAnchorManageHint(enterpriseId) {
  return request({
    url: '/user/memberAnchorAuthority/getAnchorManageHint',
    method: 'get',
    params: { enterpriseId }
  })
}

/**
 * 获取企业总部招募主播码
 */
export function doGetAnchorWxaCode(enterpriseId) {
  return request({
    url: '/user/memberAnchorAuthority/doGetAnchorWxaCode',
    method: 'get',
    params: { enterpriseId }
  })
}

// 批量更新申请状态
export function batchUpdateStatus(data) {
  return request({
    url: '/user/memberAnchorAuthority/batchUpdateStatus',
    method: 'post',
    data: data
  })
}

/**
 * 更新企业主播管理提示 0：今日不显示 1：永久关闭
 */
export function updateAnchorManageHint(enterpriseId, hintSelectStatus) {
  return request({
    url: '/user/memberAnchorAuthority/updateAnchorManageHint',
    method: 'get',
    params: { enterpriseId, hintSelectStatus }
  })
}

/**
 * 更新企业主播自动授权提示 0：今日不显示 1：永久关闭
 */
export function updateAnchorAutoAuthorityHint(enterpriseId, hintSelectStatus) {
  return request({
    url: '/user/memberAnchorAuthority/updateAnchorAutoAuthorityHint',
    method: 'get',
    params: { enterpriseId, hintSelectStatus }
  })
}

// 统计主播数据
export function countLiveAnchor(enterpriseId) {
  return request({
    url: '/user/memberAnchorAuthority/countLiveAnchor',
    method: 'get',
    params: { enterpriseId }
  })
}

// 主播清退
export function doClear(anchorAuthorityId) {
  return request({
    url: '/user/memberAnchorAuthority/doClear',
    method: 'post',
    data: { anchorAuthorityId }
  })
}

// 主播信息保存
export function saveAnchor(anchor) {
  return request({
    url: '/user/memberAnchorAuthority/save',
    method: 'post',
    data: anchor
  })
}

// 主播管理导出Excel
export function doExportAnchorManage(query) {
  return process.env.BASE_API + '/user/memberAnchorAuthority/doExportAnchorManage?' + param(query) + '&accessToken=' + getToken()
}
